package grasshopper.gcm.facade;

import grasshopper.gcm.db.CompanyAddress.AddressType;
import grasshopper.gcm.db.Company;
import grasshopper.gcm.db.CompanyAddress;

/**
 *
 * @author piotr.kobik@gmail.com
 */
public class CompanyFacade {

    /**
     * Create new Trading partner with a required empty legal address.
     *
     * @param country two letter iso country code, capital letters, like PL, SE, or US
     * @param language two letter iso language code, small letters like pl, se, en
     *
     * @return Company
     */
    public static Company createNewTradingPartner(String country, String language) {
        Company tp = new Company();
        CompanyAddress legalAddress = new CompanyAddress(tp, AddressType.Legal);
        legalAddress.setCountry(country);
        legalAddress.setLanguage(language);
        tp.getAddresses().add(legalAddress);
        return tp;
    }

}
